<template>
  <div class="head">
    <div class="left">
     <router-link to="/home"><img src="../assets/R-C.jpg" alt="" /></router-link> 
      <div class="text">
        <p>Vue</p>
        <p>博客系统</p>
      </div>
    </div>
    <div class="right">
      <div class="btn">
        <router-link to="ArticleList"> <button>博客列表</button></router-link>
        <router-link to="addArticle"> <button>添加博客</button></router-link>
        <router-link to="about"> <button>关于博客</button></router-link>
      </div>
      <!-- 屏幕小于600px -->
      <div class="btnMin">
        <ul @click="showMenu">
          <span :class="show ? 'rotate' : ''"></span>
          <li v-show="show">
            <router-link to="ArticleList"> 博客列表</router-link>
            <router-link to="addArticle"> 添加博客</router-link>
            <router-link to="about"> 关于博客</router-link>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 下拉菜单是否显示
      show: true,
    };
  },
  methods: {
    showMenu() {
      this.show = !this.show;
    },
  },
};
</script>

<style lang="less" scope>
.head {
  display: flex;
  max-width: 1000px;
  height: 100px;
  margin: 0 auto;
  justify-content: space-between;
  border: 1px solid white;
  border-radius: 0 0 5px 5px;
  color: white;
  .left {
    display: flex;
    padding-right: 20px;
   img {
      width: 100%;
      height: 100%;
      border-radius: 0 0 0 5px;
      cursor: pointer;
    }
    .text {
      padding: 20px 0px 0px 10px;
      p {
        padding: 5px 0 0 0;
      }
    }
  }
  .right {
    width: 50%;

    .btn {
      display: flex;
      text-align: center;
      justify-content: space-around;
      align-items: center;
      height: 100%;
      button {
        width: 120px;
        height: 40px;
        background-color: transparent;
        color: white;
        box-shadow: 0 0 10px white;
        font-size: 1rem;
        cursor: pointer;
      }
      button:hover {
        box-shadow: 0 0 5px white;
      }
    }
    .btnMin {
      display: none;
    }
  }
  //屏幕小于600样式
  @media screen and (max-width: 665px) {
    .right {
      .btn {
        display: none;
      }
      .btnMin {
        display: block;
      }
      ul {
        width: 30px;
        height: 40px;
        position: relative;
        display: inline-block;
        li {
          position: absolute;
          left: 154px;
          width: 100px;
          top: 70px;
          list-style: none;
          background-color: rgb(99, 96, 96);
          a {
            display: block;
            text-align: center;
            padding: 5px;
            color: #fff;
            text-decoration: none;
          }
        }
      }
      span {
        width: 30px;
        height: 4px;
        left: 187px;
        top: 48px;
        background-color: #fff;
        display: block;
        position: absolute;
        cursor: pointer;
        transition: 0.3s;
      }
      span:after {
        content: "";
        width: 30px;
        height: 4px;
        background-color: #fff;
        top: 10px;
        position: absolute;
      }
      span:before {
        content: "";
        width: 30px;
        height: 4px;
        background-color: #fff;
        top: -10px;
        position: absolute;
      }
      span.rotate {
        transform: rotate(90deg);
      }
    }
  }
}
</style>